import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppRoutingModule } from './app-routing.module';

// Imports for loading & configuring the in-memory web api
import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
import { InMemoryDataService } from './core/in-memory-data.service';

import { AppComponent } from './app.component';
import { DashboardComponent } from './dashboard/dashboard.component';

import { HeroSearchComponent } from './heroes/hero-search/hero-search.component';
import { HeroFormComponent } from './heroes/hero-form/hero-form.component';

import { LoginComponent } from './login.component';

import { HeroService } from './heroes/shared/hero.service';
import { Logger } from './core/logger.service';
import { UserService } from './core/user.service';

import { HighlightDirective } from './directives/highlight.directive';

import { TitleComponent } from './components/app-title/title.component';

// import { WikiComponent } from './wiki/wiki.component';

import { PageNotFoundComponent } from './not-found.component';
import { ComposeMessageComponent } from './core/compose-message/compose-message.component';

/* Feature Modules */
import { ContactModule } from './contact/contact.module';
import { CrisisModule } from './crisis/crisis.module';
import { HeroModule } from './heroes/hero.module';
import { LoginRoutingModule } from './login-routing.module';
import { AdminModule } from './admin/admin.module';

import { DialogService } from './dialog.service';


// 装饰器函数
@NgModule({
  //  声明本模块中拥有的视图类
  declarations: [
    AppComponent,
    DashboardComponent,
    HeroSearchComponent,
    HeroFormComponent,
    HighlightDirective,
    TitleComponent,
    // WikiComponent,
    PageNotFoundComponent,
    ComposeMessageComponent,
    LoginComponent,
  ],
  // 本模块声明的组件模板需要的类所在的其它模块
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    FormsModule,
    HttpModule,
    InMemoryWebApiModule.forRoot(InMemoryDataService),
    ContactModule,

    LoginRoutingModule,
    AppRoutingModule,

    CrisisModule,
    HeroModule,
    AdminModule,

  ],
  exports: [],
  // 服务的创建者，并加入到全局服务列表中，可用于应用任何部分
  providers: [HeroService, Logger, UserService, DialogService],
  // 指定应用的主视图（称为根组件），它是所有其它视图的宿主。只有根模块才能设置bootstrap属性
  bootstrap: [AppComponent]
})
export class AppModule { }
